#ifndef __CONFIGURATION_HPP__
#define __CONFIGURATION_HPP__

#include <string>
#include <iostream>
#include <map>
#include <set>

#include <fstream>

using std::cout;
using std::endl;
using std::map;
using std::set;
using std::string;

using std::ifstream;

class Configuration
{
private:
    Configuration(const string &configFilePath);
    ~Configuration();

public:
    static Configuration *getInstance(const string &configFilePath);
    class AutoRelease
    {
    public:
        AutoRelease()
        {
#ifdef DEBUG
            cout << "AutoRelease()" << endl;
#endif
        }

        ~AutoRelease()
        {
#ifdef DEBUG
            cout << "~AutoRelease()" << endl;
#endif
            if (_pconf)
            {
                delete _pconf;
                _pconf = nullptr;
            }
        }
    };
    map<string, string> &getConfigMap();
    set<string> &getStopWordList();
    string searchConfigMap(const string key);

private:
    string _configFilePath;
    map<string, string> _configMap;
    set<string> _stopWordList;

    static Configuration *_pconf;
    static AutoRelease _ar;
};

#endif